# -*- encoding: utf-8 -*-
"""

PyCharm 元类02.py
2024年10月21日19时46分
by wenyang

文件主要内容:


"""
# 传统方法创建类
class Foo(object):
    def __init__(self, name):
        self.name = name

    def __new__(cls, *args, **kwargs):
        data = object.__new__(cls)
        return data

# 使用type创建类
Bar = type("Bar", (object,), {"name": "wenyang", "age": 18})


def main():
    foo = Foo("wenyang")
    bar = Bar()
    print(type(foo))
    print(type(bar))



if __name__ == "__main__":
    main()
